<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>经营范围</title>

    <link href="../../resource/css/bootstrap.min.css?v=3.3.5" rel="stylesheet"
          th:href="@{/resource/css/bootstrap.min.css?v=3.3.5}"/>
    <link href="../../resource/hotui/css/font-awesome.min.css" th:href="@{/resource/hotui/css/font-awesome.min.css}"
          rel="stylesheet">
    <!-- Morris -->
    <link href="../../resource/hotui/css/plugins/morris/morris-0.4.3.min.css"
          th:href="@{/resource/hotui/css/plugins/morris/morris-0.4.3.min.css}" rel="stylesheet">
    <link href="../../resource/css/animate.min.css" rel="stylesheet" th:href="@{/resource/css/animate.min.css}"/>
    <link href="../../resource/hotui/css/style.min-1.0.8.css" th:href="@{/resource/hotui/css/style.min-1.0.8.css}"
          rel="stylesheet">
    <link href="../../resource/hotui/css/hotui.style.override.css"
          th:href="@{/resource/hotui/css/hotui.style.override.css}" rel="stylesheet"/>
    <link href="../../resource/hotui/js/plugins/datetimepick/css/daterangepicker.css"
          th:href="@{/resource/hotui/js/plugins/datetimepick/css/daterangepicker.css}" rel="stylesheet"/>

    <style type="text/css">
        .hr-line-dashed {
            margin: 10px 0;
            height: 1px;
            border-top: 1px dashed #e7eaec;
            background-color: #fff;
            color: #fff;
        }

        .table-header-btn-box {
            width: 100%;
            padding-bottom: 10px;
            text-align: right;
        }
    </style>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight tooltip-demo">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins m-b-none">
                <div class="tabs-container">
                    <div class="tab-content">
                        <div class="tab-pane active">
                            <div class="panel-body table-responsive">
                                <div class="table-header-btn-box">
                                    <button class="btn btn-success" onclick="listHandler.edit(0,'')">添加经营类目</button>
                                </div>
                                <table class="table table-bordered table-hover table-center">
                                    <thead>
                                    <tr>
                                        <th>类目ID</th>
                                        <th>类目名称</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>

                                    <tr th:each="item,stat:${list}">
                                        <td th:text="${stat.count}"></td>
                                        <td th:text="${item.title}">剑南</td>
                                        <td>
                                            <a th:href="|javascript:listHandler.edit(${item.id},'${item.title}')|"
                                               href="javascript:listHandler.edit(1,'编辑')">编辑</a>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<!--基础框架js-->
<script src="../../resource/js/jquery.min.js?v=2.1.4" th:src="@{/resource/js/jquery.min.js?v=2.1.4}"></script>
<script src="../../resource/js/bootstrap.min.js?v=3.3.5" th:src="@{/resource/js/bootstrap.min.js?v=3.3.5}"></script>
<script src="../../resource/hotui/js/hot/bootstrap.hot.extra-utils.js"
        th:src="@{/resource/hotui/js/hot/bootstrap.hot.extra-utils.js(123123)}"></script>
<script src="../../resource/hotui/js/hot/bootstrap.hot.extra-init.js"
        th:src="@{/resource/hotui/js/hot/bootstrap.hot.extra-init.js}"></script>
<script src="../../resource/hotui/js/content.min.js" th:src="@{/resource/hotui/js/content.min.js}"></script>
<script src="../../resource/lib/moment.min.js" th:src="@{/resource/lib/moment.min.js}"></script>
<script src="../../resource/hotui/js/plugins/datetimepick/js/daterangepicker.js"
        th:src="@{/resource/hotui/js/plugins/datetimepick/js/daterangepicker.js}"></script>


<script src="../resource/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="../resource/lib/jquery-validation/dist/messages_cn.js"></script>
<script src="../../resource/hotui/js/hot/bootstrap.hot.extra-validate.js"
        th:src="@{/resource/hotui/js/hot/bootstrap.hot.extra-validate.js}"></script>


<script type="text/javascript" th:inline="javascript">
    const pageUri = /*[[@{/shop/list/scope}]]*/  "";
    const ajaxUri = /*[[@{/shop/list/scope}]]*/  "";
</script>
<script>

    $(function () {
        $(document).keyup(function (event) {
            if (event.keyCode === 13) {
                $(".searchBtn").trigger("click");
            }
        });
    });

    var listHandler = {
        search: function (pageIndex) {
            $("input[name=pageIndex]").val(pageIndex);
            $("#searchForm").submit();
        },
        searchAll: function () {
            window.location.href = pageUri;
        },
        edit: function (id, title) {
            layer.prompt({title: '编辑', formType: 0, value: title}, function (text, index) {
                if (text.length === 0) {
                    hot.tip.msg("请输入内容");
                }
                hot.ajax(ajaxUri, {
                    title: text,
                    id: id
                }, function (apiResult) {
                    if (apiResult.resultCode === 2000) {
                        hot.tip.success("操作成功", function () {
                            window.location.reload();
                        }, 300);
                    } else {
                        hot.tip.error("操作失败--" + apiResult.resultMsg);
                    }
                }, function () {
                }, "post", 300);
            });
        }
    }
</script>
</body>
</html>
